package com.itheima.day05.consumer;


import com.itheima.day05.config.RabbitMQOrderConfig;
import com.itheima.day05.entity.Order;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

@Service
public class OrderConsumer {

    @RabbitListener(queues = RabbitMQOrderConfig.ORDER_QUEUE_NAME, concurrency = "3") // 启动3个消费者
    public void handleOrder(Order order) {
        //TODO 接收消息 通过Thread.sleep(1000)模拟处理时间

        System.out.println("Finished processing order: " + order);
    }
}